{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 随机数生成六个班的考试成绩，3门考试：Python、数学、语文。每个班50人"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 15,  66,  19,  62,   5,  11,  15,  38,  43,  21,  74,  89,  77,\n",
       "         47,  92,  87,  61,  85,  94,  56,  22,  67,  84,  32,  53,  80,\n",
       "         41,   1,  96,  67,   7,  17,  25,  15,  54,  55,  14,  69,  55,\n",
       "         37,   2,  51,  63,  67,  54,  73,   4,  99,  25,  26],\n",
       "       [ 16,  52,  41,  80,  15,  98,  73,  92,  42,  17,  85,  12,  60,\n",
       "         53,  15,  18,  98,   8,  88,  83,  60,   6,  42,  99,  50,  57,\n",
       "         80,  68,  20,   2,  76,  74, 100,  79,  29,  78,  32,  10,  11,\n",
       "         61,  20,  41,  65,  23,   7,  17,  99,  91,  13,   4],\n",
       "       [ 68,  68,  77,  57,  22,  42,  84,  58,  85,  31,  25,  92,  93,\n",
       "         16,  27,  75,  66,  83,  16, 100,  92,  74,  58,  26,  32,  30,\n",
       "         84,  99,  44,  95,  17,  82,  99,  27,  80,  31,   5,  69,   3,\n",
       "         97,   7,  46,   3,  79,  13,  70,  54,  37,  69,  61],\n",
       "       [  1,   8,  90,  48,  54,  63,  36,  23,  72,  85,  51,  21,  14,\n",
       "         82,  58,  65,  21,  87,   8,  16,  69,  87,  68,  23,  45,  56,\n",
       "         86,  77,  55,  57,  16,  61,  37,  99,  64,  79,  60,  29,  67,\n",
       "         59,  77,  81,  38,  37,  44,  94,  51,  54,  87,  67],\n",
       "       [ 83,  25,  45,  29,  29,  89,  37,  73,  22,  61, 100,  86,  86,\n",
       "         17,  47,  32,  92,  59,  93,  71,  83,  24,  38,  13,  83,  52,\n",
       "         49,  68,  55,  83,  89,   7,  90, 100,  53,  38,  77,   7,  82,\n",
       "         26,   2,  62,  93,   2,  65,  23,  23,  53,  15,  37],\n",
       "       [ 55,  42,  17,  33,  90,   4,  18,  63,  95,  26,  46,   5,  73,\n",
       "         12,  19,  50,  22,  99,  53,   4,  26,  71,  34,  67, 100,  47,\n",
       "         10,  69,   4,  22,  52,  79,  20,  44,  18,   7,  87,  64,  93,\n",
       "         28,  49,  18,  59,  54,  43,   5,  15,  83,  16,  77]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_s = np.random.randint(1,101,size = (6,50)) #Python 分数\n",
    "python_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 93,  63,  35,  80,  24,  87,  65,  28,  34,   2,  44,  93,  11,\n",
       "          5,  50,  26,  88,  67,  27,  91,  77,  80,  11,  95,  34,  42,\n",
       "         66,  27,  32,  63,  48,  70,   4,  34,  28,  53,  96,  61,  62,\n",
       "         55,  97,  76,  22,  38,  46,  86,  49,  22,   2,  52],\n",
       "       [ 63,  79,  51,  79,  15,  89,   1,  83,  21,  21,  87,  68,  51,\n",
       "         71,  83,   3,  96,  64,  83,  63,  86,  49, 100,  50,  80,  80,\n",
       "         47,  30,  61,  29,  92,  50,  90,  92,  49,   9,  62, 100,  31,\n",
       "         88,  17,  94,  34,  12,  54,  85,  45,  24,  34,  60],\n",
       "       [  8,   1,  84,  20,  43,  34, 100,  37,  12,  88,  33,  51,  93,\n",
       "          3,  66,  76,  81,  74,  92,  32,  33,   6,  50,  96,   5,  72,\n",
       "         43,  37,  10,  53,  18,  59,   9,  78,  84,  46,  84,  66,   7,\n",
       "         27,  35,   6,  19,  69,  80,   5,  33,   9,  94,  43],\n",
       "       [ 94,  72,  49,  27,  58,  78,  38,  28,  84,  63,  32,   9,  88,\n",
       "         29,   8,  46, 100,  60,  94,  79,  36,  29,  28,  22,  20,  28,\n",
       "         20,   1,  38,   7,  25,  72,  25,  60,  22,   5,  38,  58,  24,\n",
       "         75,   3,  70,  49,  35,  14,   4,  61,  82,  97,  42],\n",
       "       [ 94,   5,  51,  50,  60,  99,  79,  21,  84,  36,  85,  51,  62,\n",
       "         31,  60,  74,  22,  44,  81,  39,  21,  21,  59,  65,  24,  61,\n",
       "          4,  34,  46,  31,  68,  31,  97,  11,   5,  55,  55,  53,  53,\n",
       "         79,  41,  82,  92,  17,  91,  61,  24,  31,   7,  46],\n",
       "       [ 44,  28,  69,  80,  39,  15,  94,  13,  36,  90,  60,  84,  80,\n",
       "         15,  22, 100,  93,   7,  58,  99,  94,  70,  43,  63,  94,  68,\n",
       "          1,  53,  14,  44,  34,  64,  48,  52,  90,  10,  56,  75,  23,\n",
       "         30,  43,  58,  50,   5,  43,  20,  65,  71,  25,  19]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math_s = np.random.randint(1,101,size = (6,50)) #数学成绩\n",
    "math_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 96,  20,  82,  69,  21,  73,  97,  86,  80,  73,  11,  72,  40,\n",
       "          3,  18, 100,  71,  58,  36,   2,  95,  58,  15,  13,  24,  66,\n",
       "         82,  13,  47,  75,  16,  50,  87,  71,  71,   7,  19,  78,  29,\n",
       "          8,  35,  80,   9,  36,  66,  27,   3,  55,  90,  43],\n",
       "       [ 93,  30,   5,  33,  67,   8,   9,  25,  91,  69,  69,  63,  12,\n",
       "         84,  89,  71,   2,  19,  84,  73,  62,  83,  91,  53,  76,  28,\n",
       "         23,  35,  69,  62,  11,  92,  59,  81,  90,   2,  80,  76,  72,\n",
       "          9,  45,  67,  10,  84,  43,  17,  36,  19,  87,  56],\n",
       "       [  7,  87,  81,  44,  15,  49,  72,  85,  48,  34,  91,  86,  58,\n",
       "         76,  46,  73,  37,  36,  29,  41,  44,  99,  18,  44,   2,  31,\n",
       "         69,  97,   1,  92,  64,  52,  18,  69,  93,  77,  88,   9,  78,\n",
       "         90,  85,  93,  73,  16,   8,  67,  23,  24,  79,   5],\n",
       "       [ 40,  46,  40,  84,  61, 100,  77,  73,   6,  67,  11,  38,  42,\n",
       "         10,  38,  76,  27,  58,  17,  56,  32,  22,  58,   5,  69,  38,\n",
       "         43,  71,  18,  63, 100,  43, 100,  71,  63,  88,  97,  45,  29,\n",
       "         35,  95,  77,  21,  59,  42,  59,  27,  65,  58,  24],\n",
       "       [  6,  57,   1,  58,  42,  41,  96,   7,  15,  25,  70,  81,  77,\n",
       "         46,  24,  27,  37,   4,  13,  94,  78,   9,  58,  96,  73,  63,\n",
       "         61,  29,  22,  27,  77,  45,  60,  15,  70,  50,  42,  11,  26,\n",
       "         16,  32,   7,  69,  54,  23,   9,  79,  65,  33,  49],\n",
       "       [ 43,  74,  52,   2,  76,   7,  49,  90,  93,   3,  77,  98,  83,\n",
       "         40,  59,  99,   4,  59,  79,  10,  48,  35,  56,  12,  11,  72,\n",
       "         78,  28,  18,  44,   2,  28,  39,  95,   5,  50,  98,   6,  49,\n",
       "          8,  37,  55,  45,  57,  95,  83,  88,  49,  78,  26]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chinese_s = np.random.randint(1,101,size = (6,50)) #语文成绩\n",
    "chinese_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 将六个班的考试成绩进行合并得到score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([[ 15,  66,  19,  62,   5,  11,  15,  38,  43,  21,  74,  89,  77,\n",
       "          47,  92,  87,  61,  85,  94,  56,  22,  67,  84,  32,  53,  80,\n",
       "          41,   1,  96,  67,   7,  17,  25,  15,  54,  55,  14,  69,  55,\n",
       "          37,   2,  51,  63,  67,  54,  73,   4,  99,  25,  26,  16,  52,\n",
       "          41,  80,  15,  98,  73,  92,  42,  17,  85,  12,  60,  53,  15,\n",
       "          18,  98,   8,  88,  83,  60,   6,  42,  99,  50,  57,  80,  68,\n",
       "          20,   2,  76,  74, 100,  79,  29,  78,  32,  10,  11,  61,  20,\n",
       "          41,  65,  23,   7,  17,  99,  91,  13,   4,  68,  68,  77,  57,\n",
       "          22,  42,  84,  58,  85,  31,  25,  92,  93,  16,  27,  75,  66,\n",
       "          83,  16, 100,  92,  74,  58,  26,  32,  30,  84,  99,  44,  95,\n",
       "          17,  82,  99,  27,  80,  31,   5,  69,   3,  97,   7,  46,   3,\n",
       "          79,  13,  70,  54,  37,  69,  61,   1,   8,  90,  48,  54,  63,\n",
       "          36,  23,  72,  85,  51,  21,  14,  82,  58,  65,  21,  87,   8,\n",
       "          16,  69,  87,  68,  23,  45,  56,  86,  77,  55,  57,  16,  61,\n",
       "          37,  99,  64,  79,  60,  29,  67,  59,  77,  81,  38,  37,  44,\n",
       "          94,  51,  54,  87,  67,  83,  25,  45,  29,  29,  89,  37,  73,\n",
       "          22,  61, 100,  86,  86,  17,  47,  32,  92,  59,  93,  71,  83,\n",
       "          24,  38,  13,  83,  52,  49,  68,  55,  83,  89,   7,  90, 100,\n",
       "          53,  38,  77,   7,  82,  26,   2,  62,  93,   2,  65,  23,  23,\n",
       "          53,  15,  37,  55,  42,  17,  33,  90,   4,  18,  63,  95,  26,\n",
       "          46,   5,  73,  12,  19,  50,  22,  99,  53,   4,  26,  71,  34,\n",
       "          67, 100,  47,  10,  69,   4,  22,  52,  79,  20,  44,  18,   7,\n",
       "          87,  64,  93,  28,  49,  18,  59,  54,  43,   5,  15,  83,  16,\n",
       "          77]]),\n",
       " array([[ 93,  63,  35,  80,  24,  87,  65,  28,  34,   2,  44,  93,  11,\n",
       "           5,  50,  26,  88,  67,  27,  91,  77,  80,  11,  95,  34,  42,\n",
       "          66,  27,  32,  63,  48,  70,   4,  34,  28,  53,  96,  61,  62,\n",
       "          55,  97,  76,  22,  38,  46,  86,  49,  22,   2,  52,  63,  79,\n",
       "          51,  79,  15,  89,   1,  83,  21,  21,  87,  68,  51,  71,  83,\n",
       "           3,  96,  64,  83,  63,  86,  49, 100,  50,  80,  80,  47,  30,\n",
       "          61,  29,  92,  50,  90,  92,  49,   9,  62, 100,  31,  88,  17,\n",
       "          94,  34,  12,  54,  85,  45,  24,  34,  60,   8,   1,  84,  20,\n",
       "          43,  34, 100,  37,  12,  88,  33,  51,  93,   3,  66,  76,  81,\n",
       "          74,  92,  32,  33,   6,  50,  96,   5,  72,  43,  37,  10,  53,\n",
       "          18,  59,   9,  78,  84,  46,  84,  66,   7,  27,  35,   6,  19,\n",
       "          69,  80,   5,  33,   9,  94,  43,  94,  72,  49,  27,  58,  78,\n",
       "          38,  28,  84,  63,  32,   9,  88,  29,   8,  46, 100,  60,  94,\n",
       "          79,  36,  29,  28,  22,  20,  28,  20,   1,  38,   7,  25,  72,\n",
       "          25,  60,  22,   5,  38,  58,  24,  75,   3,  70,  49,  35,  14,\n",
       "           4,  61,  82,  97,  42,  94,   5,  51,  50,  60,  99,  79,  21,\n",
       "          84,  36,  85,  51,  62,  31,  60,  74,  22,  44,  81,  39,  21,\n",
       "          21,  59,  65,  24,  61,   4,  34,  46,  31,  68,  31,  97,  11,\n",
       "           5,  55,  55,  53,  53,  79,  41,  82,  92,  17,  91,  61,  24,\n",
       "          31,   7,  46,  44,  28,  69,  80,  39,  15,  94,  13,  36,  90,\n",
       "          60,  84,  80,  15,  22, 100,  93,   7,  58,  99,  94,  70,  43,\n",
       "          63,  94,  68,   1,  53,  14,  44,  34,  64,  48,  52,  90,  10,\n",
       "          56,  75,  23,  30,  43,  58,  50,   5,  43,  20,  65,  71,  25,\n",
       "          19]]),\n",
       " array([[ 96,  20,  82,  69,  21,  73,  97,  86,  80,  73,  11,  72,  40,\n",
       "           3,  18, 100,  71,  58,  36,   2,  95,  58,  15,  13,  24,  66,\n",
       "          82,  13,  47,  75,  16,  50,  87,  71,  71,   7,  19,  78,  29,\n",
       "           8,  35,  80,   9,  36,  66,  27,   3,  55,  90,  43,  93,  30,\n",
       "           5,  33,  67,   8,   9,  25,  91,  69,  69,  63,  12,  84,  89,\n",
       "          71,   2,  19,  84,  73,  62,  83,  91,  53,  76,  28,  23,  35,\n",
       "          69,  62,  11,  92,  59,  81,  90,   2,  80,  76,  72,   9,  45,\n",
       "          67,  10,  84,  43,  17,  36,  19,  87,  56,   7,  87,  81,  44,\n",
       "          15,  49,  72,  85,  48,  34,  91,  86,  58,  76,  46,  73,  37,\n",
       "          36,  29,  41,  44,  99,  18,  44,   2,  31,  69,  97,   1,  92,\n",
       "          64,  52,  18,  69,  93,  77,  88,   9,  78,  90,  85,  93,  73,\n",
       "          16,   8,  67,  23,  24,  79,   5,  40,  46,  40,  84,  61, 100,\n",
       "          77,  73,   6,  67,  11,  38,  42,  10,  38,  76,  27,  58,  17,\n",
       "          56,  32,  22,  58,   5,  69,  38,  43,  71,  18,  63, 100,  43,\n",
       "         100,  71,  63,  88,  97,  45,  29,  35,  95,  77,  21,  59,  42,\n",
       "          59,  27,  65,  58,  24,   6,  57,   1,  58,  42,  41,  96,   7,\n",
       "          15,  25,  70,  81,  77,  46,  24,  27,  37,   4,  13,  94,  78,\n",
       "           9,  58,  96,  73,  63,  61,  29,  22,  27,  77,  45,  60,  15,\n",
       "          70,  50,  42,  11,  26,  16,  32,   7,  69,  54,  23,   9,  79,\n",
       "          65,  33,  49,  43,  74,  52,   2,  76,   7,  49,  90,  93,   3,\n",
       "          77,  98,  83,  40,  59,  99,   4,  59,  79,  10,  48,  35,  56,\n",
       "          12,  11,  72,  78,  28,  18,  44,   2,  28,  39,  95,   5,  50,\n",
       "          98,   6,  49,   8,  37,  55,  45,  57,  95,  83,  88,  49,  78,\n",
       "          26]])]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_s = python_s.reshape(1,300)\n",
    "math_s = math_s.reshape(1,300)\n",
    "chinese_s = chinese_s.reshape(1,300)\n",
    "score = [python_s,math_s,chinese_s]\n",
    "score"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 生成性别数组sex，水平叠加数组sex和score得到data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1,\n",
       "       0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1,\n",
       "       0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0,\n",
       "       1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0,\n",
       "       0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1,\n",
       "       0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0,\n",
       "       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1,\n",
       "       1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1,\n",
       "       1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0,\n",
       "       1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1,\n",
       "       0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1,\n",
       "       0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1,\n",
       "       1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0,\n",
       "       0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex = np.random.randint(0,2,size = 300)\n",
    "sex"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  0,  1, ...,  0,  1,  0],\n",
       "       [15, 66, 19, ..., 83, 16, 77],\n",
       "       [93, 63, 35, ..., 71, 25, 19],\n",
       "       [96, 20, 82, ..., 49, 78, 26]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = np.vstack((sex,score[0][0],score[1][0],score[2][0]))\n",
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 分别计算男女生各科成绩统计指标：最小值、最大值、平均分、中位数、标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0],\n",
       "       [ 15,  66,  62,  38,  43,  74,  89,  47,  92,  87,  85,  94,  56,\n",
       "         22,  84,  41,   1,  67,  17,  15,  54,  55,  37,   2,  63,  54,\n",
       "         73,  25,  26,  41,  98,  73,  17,  12,  60,  53,  18,  88,  60,\n",
       "          6,  50,  68,  20,  74,  79,  29,  32,  10,  11,  41,  65,  23,\n",
       "         91,   4,  68,  77,  57,  22,  84,  25,  92,  93,  66,  83,  16,\n",
       "        100,  92,  26,  32,  95,  17,  82,  99,  27,  80,  31,   5,  69,\n",
       "          3,  97,   7,  46,   3,  69,  61,  63,  36,  23,  85,  51,  82,\n",
       "         58,  65,  16,  69,  87,  16,  61,  37,  64,  60,  37,  44,  94,\n",
       "         54,  67,  25,  29,  89,  61, 100,  86,  86,  17,  47,  92,  93,\n",
       "         83,  24,  13,  83,  52,  55,  83,  89,   7,  90, 100,  53,  77,\n",
       "         26,   2,  93,   2,  65,  23,  53,  15,  37,  55,  90,   4,  26,\n",
       "         22,  53,   4,  34,  67, 100,  47,  10,  69,   4,  79,  44,  18,\n",
       "          7,  87,  28,  18,   5,  83,  77],\n",
       "       [ 93,  63,  80,  28,  34,  44,  93,   5,  50,  26,  67,  27,  91,\n",
       "         77,  11,  66,  27,  63,  70,  34,  28,  62,  55,  97,  22,  46,\n",
       "         86,   2,  52,  51,  89,   1,  21,  68,  51,  71,   3,  83,  86,\n",
       "         49,  80,  30,  61,  50,  92,  49,  62, 100,  31,  94,  34,  12,\n",
       "         24,  60,   1,  84,  20,  43, 100,  33,  51,  93,  81,  74,  92,\n",
       "         32,  33,  96,   5,  53,  18,  59,   9,  78,  84,  46,  84,  66,\n",
       "          7,  27,  35,   6,  19,  94,  43,  78,  38,  28,  63,  32,  29,\n",
       "          8,  46,  79,  36,  29,  25,  72,  25,  22,  38,  35,  14,   4,\n",
       "         82,  42,   5,  60,  99,  36,  85,  51,  62,  31,  60,  22,  81,\n",
       "         21,  21,  65,  24,  61,  46,  31,  68,  31,  97,  11,   5,  55,\n",
       "         79,  41,  92,  17,  91,  61,  31,   7,  46,  44,  39,  15,  90,\n",
       "         93,  58,  99,  43,  63,  94,  68,   1,  53,  14,  64,  52,  90,\n",
       "         10,  56,  30,  58,  20,  71,  19],\n",
       "       [ 96,  20,  69,  86,  80,  11,  72,   3,  18, 100,  58,  36,   2,\n",
       "         95,  15,  82,  13,  75,  50,  71,  71,  29,   8,  35,   9,  66,\n",
       "         27,  90,  43,   5,   8,   9,  69,  63,  12,  84,  71,  84,  62,\n",
       "         83,  76,  35,  69,  92,  81,  90,  80,  76,  72,  67,  10,  84,\n",
       "         19,  56,  87,  81,  44,  15,  72,  91,  86,  58,  37,  36,  29,\n",
       "         41,  44,  44,   2,  92,  64,  52,  18,  69,  93,  77,  88,   9,\n",
       "         78,  90,  85,  93,  73,  79,   5, 100,  77,  73,  67,  11,  10,\n",
       "         38,  76,  56,  32,  22, 100,  43, 100,  63,  97,  59,  42,  59,\n",
       "         65,  24,  57,  42,  41,  25,  70,  81,  77,  46,  24,  37,  13,\n",
       "         78,   9,  96,  73,  63,  22,  27,  77,  45,  60,  15,  70,  42,\n",
       "         16,  32,  69,  54,  23,   9,  65,  33,  49,  43,  76,   7,   3,\n",
       "          4,  79,  10,  56,  12,  11,  72,  78,  28,  18,  28,  95,   5,\n",
       "         50,  98,   8,  55,  83,  49,  26]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[  1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,\n",
       "          1,   1,   1,   1,   1,   1,   1],\n",
       "       [ 19,   5,  11,  15,  21,  77,  61,  67,  32,  53,  80,  96,   7,\n",
       "         25,  55,  14,  69,  51,  67,   4,  99,  16,  52,  80,  15,  92,\n",
       "         42,  85,  15,  98,   8,  83,  42,  99,  57,  80,   2,  76, 100,\n",
       "         78,  61,  20,   7,  17,  99,  13,  68,  42,  58,  85,  31,  16,\n",
       "         27,  75,  74,  58,  30,  84,  99,  44,  79,  13,  70,  54,  37,\n",
       "          1,   8,  90,  48,  54,  72,  21,  14,  21,  87,   8,  68,  23,\n",
       "         45,  56,  86,  77,  55,  57,  99,  79,  29,  67,  59,  77,  81,\n",
       "         38,  51,  87,  83,  45,  29,  37,  73,  22,  32,  59,  71,  38,\n",
       "         49,  68,  38,   7,  82,  62,  23,  42,  17,  33,  18,  63,  95,\n",
       "         46,   5,  73,  12,  19,  50,  99,  26,  71,  22,  52,  20,  64,\n",
       "         93,  49,  59,  54,  43,  15,  16],\n",
       "       [ 35,  24,  87,  65,   2,  11,  88,  80,  95,  34,  42,  32,  48,\n",
       "          4,  53,  96,  61,  76,  38,  49,  22,  63,  79,  79,  15,  83,\n",
       "         21,  87,  83,  96,  64,  63, 100,  50,  80,  47,  29,  92,  90,\n",
       "          9,  88,  17,  54,  85,  45,  34,   8,  34,  37,  12,  88,   3,\n",
       "         66,  76,   6,  50,  72,  43,  37,  10,  69,  80,   5,  33,   9,\n",
       "         94,  72,  49,  27,  58,  84,   9,  88, 100,  60,  94,  28,  22,\n",
       "         20,  28,  20,   1,  38,   7,  60,   5,  58,  24,  75,   3,  70,\n",
       "         49,  61,  97,  94,  51,  50,  79,  21,  84,  74,  44,  39,  59,\n",
       "          4,  34,  55,  53,  53,  82,  24,  28,  69,  80,  94,  13,  36,\n",
       "         60,  84,  80,  15,  22, 100,   7,  94,  70,  44,  34,  48,  75,\n",
       "         23,  43,  50,   5,  43,  65,  25],\n",
       "       [ 82,  21,  73,  97,  73,  40,  71,  58,  13,  24,  66,  47,  16,\n",
       "         87,   7,  19,  78,  80,  36,   3,  55,  93,  30,  33,  67,  25,\n",
       "         91,  69,  89,   2,  19,  73,  91,  53,  28,  23,  62,  11,  59,\n",
       "          2,   9,  45,  43,  17,  36,  87,   7,  49,  85,  48,  34,  76,\n",
       "         46,  73,  99,  18,  31,  69,  97,   1,  16,   8,  67,  23,  24,\n",
       "         40,  46,  40,  84,  61,   6,  38,  42,  27,  58,  17,  58,   5,\n",
       "         69,  38,  43,  71,  18,  63,  71,  88,  45,  29,  35,  95,  77,\n",
       "         21,  27,  58,   6,   1,  58,  96,   7,  15,  27,   4,  94,  58,\n",
       "         61,  29,  50,  11,  26,   7,  79,  74,  52,   2,  49,  90,  93,\n",
       "         77,  98,  83,  40,  59,  99,  59,  48,  35,  44,   2,  39,   6,\n",
       "         49,  37,  45,  57,  95,  88,  78]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "a = np.where(data[0] == 0)\n",
    "b = np.where(data[0] == 1)\n",
    "score_boy = np.vstack((data[0][a],data[1][a],data[2][a],data[3][a])) #男生成绩\n",
    "score_girl = np.vstack((data[0][b],data[1][b],data[2][b],data[3][b])) #男生成绩\n",
    "display(score_boy,score_girl)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "heading_collapsed": true
   },
   "source": [
    "## 最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 1, 2])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score_boy_min = np.min(score_boy,axis = 1)\n",
    "score_boy_min"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "男生:python成绩最小值为1，数学成绩最小值为1，语文成绩最小值为2\n"
     ]
    }
   ],
   "source": [
    "print('男生:python成绩最小值为%d，数学成绩最小值为%d，语文成绩最小值为%d' %(score_boy_min[1],score_boy_min[2],score_boy_min[3]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 1, 1])"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score_girl_min = np.min(score_girl,axis = 1)\n",
    "score_girl_min"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "女生:python成绩最小值为1，数学成绩最小值为1，语文成绩最小值为1\n"
     ]
    }
   ],
   "source": [
    "print('女生:python成绩最小值为%d，数学成绩最小值为%d，语文成绩最小值为%d' %(score_girl_min[1],score_girl_min[2],score_girl_min[3]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "heading_collapsed": true
   },
   "source": [
    "## 最大值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([  0, 100, 100, 100])"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score_boy_max = np.max(score_boy,axis = 1)\n",
    "score_boy_max"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "男生:python成绩最大值为100，数学成绩最大值为100，语文成绩最大值为100\n"
     ]
    }
   ],
   "source": [
    "print('男生:python成绩最大值为%d，数学成绩最大值为%d，语文成绩最大值为%d' %(score_boy_max[1],score_boy_max[2],score_boy_max[3]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([  1, 100, 100,  99])"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score_girl_max = np.max(score_girl,axis = 1)\n",
    "score_girl_max"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "hidden": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "女生:python成绩最大值为100，数学成绩最大值为100，语文成绩最大值为99\n"
     ]
    }
   ],
   "source": [
    "print('女生:python成绩最大值为%d，数学成绩最大值为%d，语文成绩最大值为%d' %(score_girl_max[1],score_girl_max[2],score_girl_max[3]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 平均分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "score_boy_mean = np.mean(score_boy,axis = 1)\n",
    "score_girl_mean = np.mean(score_girl,axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "男生:python成绩平均分为51.42，数学成绩平均分为49.56，语文成绩平均分为51.94\n",
      "女生:python成绩平均分为49.93，数学成绩平均分为50.66，语文成绩平均分为47.96\n"
     ]
    }
   ],
   "source": [
    "print('男生:python成绩平均分为%.2f，数学成绩平均分为%.2f，语文成绩平均分为%.2f' %(score_boy_mean[1],score_boy_mean[2],score_boy_mean[3]))\n",
    "print('女生:python成绩平均分为%.2f，数学成绩平均分为%.2f，语文成绩平均分为%.2f' %(score_girl_mean[1],score_girl_mean[2],score_girl_mean[3]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 中位数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "score_boy_median = np.median(score_boy,axis = 1)\n",
    "score_girl_median = np.median(score_girl,axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "男生:python成绩中位数为54，数学成绩中位数为49，语文成绩中位数为56\n",
      "女生:python成绩中位数为52，数学成绩中位数为50，语文成绩中位数为46\n"
     ]
    }
   ],
   "source": [
    "print('男生:python成绩中位数为%d，数学成绩中位数为%d，语文成绩中位数为%d' %(score_boy_median[1],score_boy_median[2],score_boy_median[3]))\n",
    "print('女生:python成绩中位数为%d，数学成绩中位数为%d，语文成绩中位数为%d' %(score_girl_median[1],score_girl_median[2],score_girl_median[3]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "score_boy_std = np.std(score_boy,axis = 1)\n",
    "score_girl_std = np.std(score_girl,axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "男生:python成绩标准差为30.18，数学成绩标准差为28.42，语文成绩标准差为29.57\n",
      "女生:python成绩标准差为28.63，数学成绩标准差为29.16，语文成绩标准差为29.00\n"
     ]
    }
   ],
   "source": [
    "print('男生:python成绩标准差为%.2f，数学成绩标准差为%.2f，语文成绩标准差为%.2f' %(score_boy_std[1],score_boy_std[2],score_boy_std[3]))\n",
    "print('女生:python成绩标准差为%.2f，数学成绩标准差为%.2f，语文成绩标准差为%.2f' %(score_girl_std[1],score_girl_std[2],score_girl_std[3]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
